Skip to content

creation of script to generate csv#40

Open
ubiquitin wants to merge 1 commit into18F:masterfrom
ubiquitin:patch-3
Open

creation of script to generate csv#40
ubiquitin wants to merge 1 commit into18F:masterfrom
ubiquitin:patch-3

Conversation

@ubiquitin
Copy link
Copy Markdown

simple file conversion json to csv for working with current FedRAMP data in Excel

simple file conversion json to csv for working with current FedRAMP data in Excel
@ubiquitin
Copy link
Copy Markdown
Author

ubiquitin commented Apr 22, 2020

request for @JohnWHamilton or @lauraGgit to test / review this simple script

@reedloden
Copy link
Copy Markdown

To be clear, you want to convert the giant data.json JSON into a CSV that you can use within Excel, yes?

As an alternate to Python and dealing with pip and possible virtualenvs, can use Homebrew with a few commands that could just be put into a bash script.

brew install csvkit jq

curl -s -o fedramp-data.json https://raw.githubusercontent.com/18F/fedramp-data/master/data/data.json

For CSPs:
jq .data.Providers < fedramp-data.json | in2csv -f json > fedramp-providers.csv

For 3PAOs:
jq .data.Assessors < fedramp-data.json | in2csv -f json > fedramp-assessors.csv

Both fedramp-providers.csv and fedramp-assessors.csv open fine in Excel from local testing.

@reedloden
Copy link
Copy Markdown

Here's a simple version of the script:

#!/bin/sh
#
# Convert FedRAMP Marketplace data from JSON into CSV
#
# Requires: `brew install csvkit jq`
#

set -e

FEDRAMP_DATA=$(mktemp -t fedramp-data)

curl -s -o $FEDRAMP_DATA https://raw.githubusercontent.com/18F/fedramp-data/master/data/data.json

META_DATE=$(jq -r .meta.Created_At < $FEDRAMP_DATA | cut -f 1 -d 'T')

jq .data.Providers < $FEDRAMP_DATA | in2csv -f json > fedramp-providers-$META_DATE.csv

jq .data.Assessors < $FEDRAMP_DATA | in2csv -f json > fedramp-assessors-$META_DATE.csv

rm $FEDRAMP_DATA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants